<%@ taglib uri="/tld/extremecomponents" prefix="ec" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

	<script src = "../js/jquery-1.12.1.js" type = "text/javascript"></script>
	<script src = "../js/jquery.validate.js" type = "text/javascript"></script>
	<script src = "../js/messages_zh.js" type = "text/javascript"></script>
	<script src = "../js/common.js" type = "text/javascript"></script>
	
	<link href="<%=request.getContextPath() %>/css/extremecomponents.css" rel="stylesheet" type="text/css" />
	<link href="<%=request.getContextPath() %>/css/global.css" rel="stylesheet" type="text/css" />
	<title>kkkkk</title>
	<!-- <style>
		#SetJob label.error {
			margin-left: 10px;
			width: auto;
			color:red;
			display: inline;
		}
	</style> -->
</head>
<body>
<div id="current">当前位置：作业管理 &gt; 设置作业</div>
    <form id="SetJobForm" name="SetJobForm" method="post">
        <table width="600" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td height="30" align="center" class="xxpage">
                	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td width="14%" class="xxpage_td2">当前用户：</td>
                            <td width="86%" class="xxpage_td2">
                              	<input name="userName" id="userName" type="text" value="<c:out value="${BASICINFO[0].teacher_name}"/>"   readonly="true" />
                            </td>
                        </tr>
                        <tr>
                            <td class="xxpage_td2">所授课程：</td>
                            <td class="xxpage_td2">
                            	<input name="courseName" id="courseName" type="text" value="<c:out value='${BASICINFO[0].course_name}'/>"   readonly="true " />
                            	<%-- <input name="courseId" id="courseId" type="hidden" value="${JOBINFO[0].course_id}" /> --%>
                            </td>
                        </tr>
                        <tr>
                            <td class="xxpage_td2">任课班级：</td>
                            <td width="86%" class="xxpage_td2">
                              <input name="courseClassName" id="courseClassName" type="text" value="<c:out value="${BASICINFO[0].course_class_name}"/>"   readonly="true" />
                              <%-- <input name="classId" id="classId" type="hidden" value="${BASICINFO[0].class_id}" /> --%>
                            </td>
                        </tr>
                        <tr>
                            <td class="xxpage_td2">作业次数：</td>
                            <td class="xxpage_td2">
                            	<input name="jobTimes" id="jobTimes" type="text" value="<c:out value='${JOBINFO[0].job_total_time}'/>"  />
                           			<input name="oldJobTimes" id="oldJobTimes" type="hidden" value="<c:out value='${JOBINFO[0].job_total_time}'/>"  />
                            </td>
                        </tr>
                    </table>
                 </td>
            </tr>
        </table>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td width="49%" height="40" align="right"><input id="btnadd" name="btnadd" type="button" class="btn_2" value="确认" /></td>
                <td width="2%" align="center">&nbsp;</td>
                <td align="left"><input id="reset" name="reset" type="reset" class="btn_2" value="重置" /></td>
            </tr>
        </table>
    </form>
<script>
//增加
	$("#btnadd").click(function() {
		var oldJobTimes = $("input[name=oldJobTimes]").val();
		var newJobTimes = $("input[name=jobTimes]").val();
		var reg = /^\+?[1-9][0-9]*$/;//判断是否为整数
	    if(!reg.test($("input[name=jobTimes]").val())){
	        alert("作业次数应为正整数！");
	        return false;
	    }else if(newJobTimes<oldJobTimes || newJobTimes==oldJobTimes){
	    	alert("作业次数已关联其他数据，不可减少！");
	        return false;
	    }else{
	        $.ajax({
	            type : "post",
	            dataType : "text",
	            url : "job?ActionType=job_Add",
	            data : $("#SetJobForm").serialize(),
	            success : function(massage) {
	                if (massage == 'success') {
	                	goTo("job?ActionType=job_Add");
	                }
	            }
	        });
	    }
	 });
</script>
</body>
</html>